'use strict'

//node: 开头表示导入Node.js官方模块
const http = require('node:http')

let html = `<!DOCTYPE html><html
  <head></head>
  <body>
    <div style="color:#df3456;background:1234567;">
      OK, First Website
    </div>
  </body>
</html>`

let serv = http.createServer((req, res) => {
  res.setHeader('content-type', 'text/html')
  //消息头识别是不是小程序
  if (req.headers.minip) {
    res.end('<div>OK,First Website</div>')
  } else {
    res.end(html)
  }
})

serv.listen(3003)
